package com.mtbu.servlet.sys;

import java.util.TimerTask;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;



public class MyTask extends TimerTask {
    private static Logger logger = LoggerFactory.getLogger(MyTask.class);
    int tick = 0;

    static MyTask mt = new MyTask();
    static boolean running = false;

    public static void reset() {
        running = false;
    }

    public static String reload() {
        if(running) {
            return "running return";
        }
        running = true;
        try {
            mt.run();
        } catch(Exception e) {
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        running = false;
        return "ok";
    }

    @Override
    public synchronized void run() {

    }

    public static void main(String[] args) {
        new MyTask().run();
    }

}
